<?php

    class Core extends BaseCore
    {
        
        function route()
       {
           if(isset($_GET['module']))
           {
               $module =   $_GET['module'].'Action';
               $this->action =  new $module(); 
               
           }
           else
           {
               if($this->admin) 
               {
                    header("Location: home");                   
               }
               else
               {
                    header("Location: 0/home");    
               }
                     
           }
           
           if(isset($_GET['action']))
           {
               $action = ucwords($_GET['action']);
               $action = 'execute'.$action;

               if(in_array($action,get_class_methods($module)))
               {
                 $this->action->$action();  
               }
               else
               {
                   $this->action->setContent('404.tpl');
               }
           }
           else
           {
               $this->action->executeIndex();
           }
           
           self::$tpl->assign( 'content', $this->action->getContent());  
           self::$tpl->assign('sub',$this->action->getSub());
           self::$tpl->assign('locationActief',$this->action->getLocation());
           
           if( core::$user->is_ingelogd() && core::$user->getUser()->getRank() >= 3)
           {
               self::$helper->setJs('Adminbar.js');
               self::$helper->setCss('Adminbar.css');
           }
           

       }
       
       function globalAssigns()
       {
           if(!$this->admin)
           {
               
               $posities = new Posities();
               self::$tpl->assign('posities',$posities);
           }             
           parent::globalAssigns();
       }
                  
    }
    
?>
